package com.xuebusi.toutiao.admin.api.article.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xuebusi.toutiao.admin.api.article.dao.ArticleChannelDao;
import com.xuebusi.toutiao.admin.api.article.entity.ChannelEntity;
import com.xuebusi.toutiao.admin.api.article.service.ArticleChannelService;
import com.xuebusi.toutiao.admin.api.article.vo.ChannelRVO;
import com.xuebusi.toutiao.admin.api.common.result.ApiResult;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 文章频道服务实现类
 */
@Service("articleChannelService")
public class ArticleChannelServiceImpl extends ServiceImpl<ArticleChannelDao, ChannelEntity> implements ArticleChannelService {
    /**
     * 频道列表
     *
     * @return
     */
    @Override
    public ResponseEntity<ApiResult<ChannelRVO>> getChannels() {
        List<ChannelEntity> channels = this.list();
        ChannelRVO channelRVO = new ChannelRVO(channels);
        return ResponseEntity.ok(ApiResult.ok(channelRVO));
    }
}
